/**
 */
package gatperdut.chato.model.Chato.Player.impl;

import gatperdut.chato.model.Chato.Entity.PC;

import gatperdut.chato.model.Chato.Player.Player;
import gatperdut.chato.model.Chato.Player.PlayerPackage;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.internal.cdo.CDOObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Player</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link gatperdut.chato.model.Chato.Player.impl.PlayerImpl#getUsername <em>Username</em>}</li>
 *   <li>{@link gatperdut.chato.model.Chato.Player.impl.PlayerImpl#getPassword <em>Password</em>}</li>
 *   <li>{@link gatperdut.chato.model.Chato.Player.impl.PlayerImpl#isAdmin <em>Admin</em>}</li>
 *   <li>{@link gatperdut.chato.model.Chato.Player.impl.PlayerImpl#getCurrentPC <em>Current PC</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PlayerImpl extends CDOObjectImpl implements Player {
	/**
     * The default value of the '{@link #getUsername() <em>Username</em>}' attribute.
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @see #getUsername()
     * @generated
     * @ordered
     */
	protected static final String USERNAME_EDEFAULT = null;

	/**
     * The default value of the '{@link #getPassword() <em>Password</em>}' attribute.
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @see #getPassword()
     * @generated
     * @ordered
     */
	protected static final String PASSWORD_EDEFAULT = null;

	/**
     * The default value of the '{@link #isAdmin() <em>Admin</em>}' attribute.
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @see #isAdmin()
     * @generated
     * @ordered
     */
	protected static final boolean ADMIN_EDEFAULT = false;

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	protected PlayerImpl() {
        super();
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	protected EClass eStaticClass() {
        return PlayerPackage.Literals.PLAYER;
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	protected int eStaticFeatureCount() {
        return 0;
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public String getUsername() {
        return (String)eDynamicGet(PlayerPackage.PLAYER__USERNAME, PlayerPackage.Literals.PLAYER__USERNAME, true, true);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public void setUsername(String newUsername) {
        eDynamicSet(PlayerPackage.PLAYER__USERNAME, PlayerPackage.Literals.PLAYER__USERNAME, newUsername);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public String getPassword() {
        return (String)eDynamicGet(PlayerPackage.PLAYER__PASSWORD, PlayerPackage.Literals.PLAYER__PASSWORD, true, true);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public void setPassword(String newPassword) {
        eDynamicSet(PlayerPackage.PLAYER__PASSWORD, PlayerPackage.Literals.PLAYER__PASSWORD, newPassword);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public boolean isAdmin() {
        return (Boolean)eDynamicGet(PlayerPackage.PLAYER__ADMIN, PlayerPackage.Literals.PLAYER__ADMIN, true, true);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public void setAdmin(boolean newAdmin) {
        eDynamicSet(PlayerPackage.PLAYER__ADMIN, PlayerPackage.Literals.PLAYER__ADMIN, newAdmin);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public PC getCurrentPC() {
        return (PC)eDynamicGet(PlayerPackage.PLAYER__CURRENT_PC, PlayerPackage.Literals.PLAYER__CURRENT_PC, true, true);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public NotificationChain basicSetCurrentPC(PC newCurrentPC, NotificationChain msgs) {
        msgs = eDynamicInverseAdd((InternalEObject)newCurrentPC, PlayerPackage.PLAYER__CURRENT_PC, msgs);
        return msgs;
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	public void setCurrentPC(PC newCurrentPC) {
        eDynamicSet(PlayerPackage.PLAYER__CURRENT_PC, PlayerPackage.Literals.PLAYER__CURRENT_PC, newCurrentPC);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case PlayerPackage.PLAYER__CURRENT_PC:
                PC currentPC = getCurrentPC();
                if (currentPC != null)
                    msgs = ((InternalEObject)currentPC).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PlayerPackage.PLAYER__CURRENT_PC, null, msgs);
                return basicSetCurrentPC((PC)otherEnd, msgs);
        }
        return super.eInverseAdd(otherEnd, featureID, msgs);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case PlayerPackage.PLAYER__CURRENT_PC:
                return basicSetCurrentPC(null, msgs);
        }
        return super.eInverseRemove(otherEnd, featureID, msgs);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case PlayerPackage.PLAYER__USERNAME:
                return getUsername();
            case PlayerPackage.PLAYER__PASSWORD:
                return getPassword();
            case PlayerPackage.PLAYER__ADMIN:
                return isAdmin();
            case PlayerPackage.PLAYER__CURRENT_PC:
                return getCurrentPC();
        }
        return super.eGet(featureID, resolve, coreType);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case PlayerPackage.PLAYER__USERNAME:
                setUsername((String)newValue);
                return;
            case PlayerPackage.PLAYER__PASSWORD:
                setPassword((String)newValue);
                return;
            case PlayerPackage.PLAYER__ADMIN:
                setAdmin((Boolean)newValue);
                return;
            case PlayerPackage.PLAYER__CURRENT_PC:
                setCurrentPC((PC)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public void eUnset(int featureID) {
        switch (featureID) {
            case PlayerPackage.PLAYER__USERNAME:
                setUsername(USERNAME_EDEFAULT);
                return;
            case PlayerPackage.PLAYER__PASSWORD:
                setPassword(PASSWORD_EDEFAULT);
                return;
            case PlayerPackage.PLAYER__ADMIN:
                setAdmin(ADMIN_EDEFAULT);
                return;
            case PlayerPackage.PLAYER__CURRENT_PC:
                setCurrentPC((PC)null);
                return;
        }
        super.eUnset(featureID);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public boolean eIsSet(int featureID) {
        switch (featureID) {
            case PlayerPackage.PLAYER__USERNAME:
                return USERNAME_EDEFAULT == null ? getUsername() != null : !USERNAME_EDEFAULT.equals(getUsername());
            case PlayerPackage.PLAYER__PASSWORD:
                return PASSWORD_EDEFAULT == null ? getPassword() != null : !PASSWORD_EDEFAULT.equals(getPassword());
            case PlayerPackage.PLAYER__ADMIN:
                return isAdmin() != ADMIN_EDEFAULT;
            case PlayerPackage.PLAYER__CURRENT_PC:
                return getCurrentPC() != null;
        }
        return super.eIsSet(featureID);
    }

} //PlayerImpl
